import request from "@/apis/request";

//模糊查询
export const getUserByKeyword  = (keyword) => {
    return request({
        url: '/manage/getUserByKeyword',
        method: 'get',
        params:{
            keyword
        }
    })
}

export const login = ({username, password}) => {
    return request({
        url: '/user/login',
        method: 'POST',
        data: {
            username,
            password
        }

    })
}
export const register = ({nickname,username, password}) => {
    return request({
        url: '/user/register',
        method: 'post',
        data: {
            nickname,
            username,
            password
        }
    })
}
export function logout(){
    return request({
        url:'/user/logout',
        method:'get'
    })
}
export const getListUser=()=>{
    return request({
        url:'/manage/getUserList',
        method:'get'
    })
}

export const  getPersonalInfo=()=>{
    return request({
        url:'/user/getProfile',
        method:'get'
    })
}
export const updatePerInfo = (nickname,password)=>{
    return request({
        url:'/user/updateProfile',
        method:'post',
        data:{
            nickname,
            password
        }
    })
}
export const banUserById = (userId)=>{
    return request({
        url:'manage/banUser',
        method:'get',
        params:{
            userId
        }
    })
}
export const cancelBanuserById=(userId)=>{
    return request({
        url:'manage/allowUser',
        method:'get',
        params:{
            userId
        }
    })
}
export const deleteUserById = (userId)=>{
    return request({
        url:'manage/deleteUser',
        method:'get',
        params:{
            userId
        }
    })
}